<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        /**
         *   //         0 1 2 3
         *   var arr = [2,3,4,5];
         *   var num = 1;
         *   ==>   [1,2,3,4,5]
         * 
         *   arr[4] = arr[3]  ==>  [2,3,4,5,5]
         *   arr[3] = arr[2]  ==>  [2,3,4,4,5]
         *   arr[2] = arr[1]  ==>  [2,3,3,4,5]
         *   arr[1] = arr[0]  ==>  [2,2,3,4,5]
         * 
         *   arr[0] = num;
         */
        var arr = [2,3,4,5];
        var num = 100;
        for (var i = arr.length - 1; i >= 0;i--){
            arr[i + 1] = arr[i];
        }
        arr[0] = num;
        console.log(arr);

    </script>
</body>

</html>